int analogPin = A0;
int LEDPin[]={ 0,1,2,3,4,5,6,7 };
int LEDCount = 8;
void setup()
{
   for(int temp = 0; temp < LEDCount; temp++)
  {
     pinMode(LEDPin[temp],OUTPUT);
  } 
}

void loop()
{
   int analoglevel = analogRead(analogPin);
   int LEDLevel = map(analoglevel,0,1023,0,LEDCount);
   for(int num = 0; num < LEDCount; num++)
   {
   if(num < LEDLevel)
  {
     digitalWrite(LEDPin[num],HIGH);
  }
  else
  {
     digitalWrite(LEDPin[num],LOW); 
  }
   } 
}
